package com.rectcircle.dao

import com.rectcircle.db.AuthorDb
import com.rectcircle.model.Author

//将tx交给service层，未来添加缓存管理
object AuthorDao{
	def save(b:Author):Author = {
		AuthorDb.save(b)
	}

	def get(id:Long) = {
		AuthorDb.getById(id)
	}
	
	def getByFirstName(name:String) ={
		AuthorDb.findByFirstName(name).single
	}
	
	def getAllBookOfAuthors = {
		AuthorDb.findAllAuthorBooksDetail
	}
	
	def withBooks(author: Author) ={
		AuthorDb.withBook(author)
	}
	
}